home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 6: Level 6 / 17 Bit - Level 6 (1998)(Epic Marketing)[!].iso / quartz / q0429.dms / q0429.adf / libray / libobj / triangle.h < prev   
C/C++ Source or Header  |  1991-08-08  |  2KB  |  55 lines

  1. /*
  2.  * triangle.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * $Id: triangle.h,v 4.0 91/07/17 14:39:43 kolb Exp Locker: kolb $
  17.  *
  18.  * $Log:    triangle.h,v $
  19.  * Revision 4.0  91/07/17  14:39:43  kolb
  20.  * Initial version.
  21.  * 
  22.  */
  23. #ifndef TRIANGLE_H
  24. #define TRIANGLE_H
  25.  
  26. #define FLATTRI        0
  27. #define PHONGTRI    1
  28.  
  29. #define GeomTriangleCreate(t,a,b,c,d,e,f,g,h,i,s)  GeomCreate( \
  30.         (GeomRef)TriangleCreate(t,a,b,c,d,e,f,g,h,i,s), TriangleMethods())
  31.  
  32. /*
  33.  * Triangle
  34.  */
  35. typedef struct {
  36.     Vector    nrm,        /* triangle normal */
  37.         p[3],        /* vertices */
  38.         e[3],        /* "edge" vectors (scaled) */
  39.         *vnorm,        /* Array of vertex normals */
  40.         *dpdu, *dpdv;    /* U and V direction vectors */
  41.     Float    d,        /* plane constant  */
  42.         b[3];        /* Array of barycentric coordinates */
  43.     Vec2d    *uv;        /* Array of UV coordinates of vertices */
  44.     char    index,        /* Flag used for shading/intersection test. */
  45.         type;        /* type (to detect if phong or flat) */
  46. } Triangle;
  47.  
  48. extern Triangle    *TriangleCreate();
  49. extern int    TriangleIntersect(), TriangleNormal();
  50. extern void    TriangleBounds(), TriangleUV(),
  51.         TriangleStats();
  52. extern Methods    *TriangleMethods();
  53. char        *TriangleName();
  54. #endif /* TRIANGLE_H */
  55.